{% extends 'base.html' %}
{% load static %}
{% load i18n %}
{% load  sizeformat %}

{% block head %}
    <link rel="stylesheet" type="text/css" href="{% static 'network/vlan_list.css' %}">
{% endblock %}
{% block title %}{% translate 'VLAN列表' %}{% endblock %}

{% block boby %}
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <span class="card-title"><strong>{% translate 'VLAN列表' %}</strong></span>
            </div>
            <div class="card-body" style="min-height: 400px;">
                <table class="table table-vm-list" style="word-wrap:break-word;word-break:break-all;">
                     <thead class="thead-light">
                    <tr>
                        <th>{% translate '编号' %}</th>
                        <th>{% translate '网桥名' %}</th>
                        <th>VLANID</th>
                        <th>{% translate 'VLAN描述' %}</th>
                        <th>{% translate '类型' %}</th>
                        <th>{% translate '标签' %}</th>
                        <th>{% translate '子网IP地址' %}</th>
                        <th>{% translate '子网掩码' %}</th>
                        <th>{% translate '网关' %}</th>
                        <th>{% translate '子网IP地址' %}(IPv6)</th>
                        <th>{% translate '子网掩码' %}(IPv6)</th>
                        <th>{% translate '网关' %}(IPv6)</th>
                        <th>{% translate '空闲IP地址(可用/总数)' %}</th>
                        <th>{% translate '状态' %}</th>
                        <th>{% translate '备注' %}</th>
                        <th>{% translate '操作选项' %}</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for vlan in vlans %}
                    <tr>
                        <th>{{ vlan.id }}</th>
                        <th>{{ vlan.br }}</th>
                        <th>{{ vlan.vlan_id| default:'' }}</th>
                        <th>{{ vlan.name }}</th>
                        <th>{{ vlan.net_type }}</th>
                        <th>{{ vlan.tag_display }}</th>
                        <th>{{ vlan.subnet_ip }}</th>
                        <th>{{ vlan.net_mask }}</th>
                        <th>{{ vlan.gateway }}</th>
                        <th>{{ vlan.subnet_ip_v6 |default_if_none:""}}</th>
                        <th>{{ vlan.net_mask_v6 |default_if_none:""}}</th>
                        <th>{{ vlan.gateway_v6 |default_if_none:""}}</th>
                        <th>{{ vlan.free_ip }}</th>
                        {% if vlan.enable %}
                            <th><i class="fa fa-check"></i></th>
                        {% else %}
                            <th><i class="fa fa-times"></i></th>
                        {% endif %}
                        <th>{{ vlan.remarks }}</th>
                        <th>
                            <span><a class="btn btn-sm btn-primary" href="{% url 'network:vlan_add' %}?vlan={{ vlan.id }}">
                                <i class="fa fa-plus"></i> {% translate '批量添加IP' %}
                            </a></span>
                            <span><a class="btn btn-sm btn-primary" href="{% url 'network:vlan_show' %}?vlan={{ vlan.id }}">
                                <i class="fa fa-search"></i> {% translate '查看IP列表IP' %}
                            </a></span>
                        </th>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script type="text/javascript" src="{% static 'network/vlan_list.js' %}"></script>
{% endblock %}

